#pragma once

#include <string>

namespace streamdb {

class Nameable {
public:
    Nameable(const std::string & name) : name(name) {}
    virtual ~Nameable(){}

    const std::string & getName() const { return name; }
    void setName(const std::string & name) { this->name = name; }
private:
    std::string name;
};

class Closable {
public:
    virtual ~Closable() {}
    virtual void close() = 0;
};


template<typename T>
class IObserver {
public:
    virtual ~IObserver(){}
    virtual void update(const T & object) = 0;
};

template<typename T, typename O>
class ISubject {
public:
    virtual ~ISubject(){}

    virtual bool attach(const O & observer) = 0;
    virtual void detach(const O & observer) = 0;

    virtual void notify(const T & object) const = 0; 
};


template<typename T>
class Iterator {
public:
    virtual ~Iterator(){}

    virtual bool hasNext() const = 0;
    virtual T & next()  = 0;
};

template<typename T>
class IIterator {
public:
    virtual ~IIterator(){}

    virtual bool hasNext() const = 0;
    virtual T * next()  = 0;
};

}//namespace streamdb
